<template>
  <div></div>
</template>

<script>
let clickHandler = null,
export default {
     name:'',
    components: {

    },
    props: {

    },
    data() {
        return {
            clickHandler:null
        };
    },
    computed: {

    },
    watch: {

    },
    created() {

    },
    mounted() {

    },
    methods: {
       // 图层点击事件
    layerClickHandler() {
      const that = this;
      this.clickHandler = new Cesium.ScreenSpaceEventHandler(
        this.viewer.scene.canvas
      );
      this.clickHandler.setInputAction((e) => {
        let position = Cesium.Cartographic.fromCartesian(
          that.viewer.scene.pickPosition(e.position)
        );
        // 将获取到的纬度经度由弧度转为角度
        position.longitude = Cesium.Math.toDegrees(position.longitude);
        position.latitude = Cesium.Math.toDegrees(position.latitude);
        const queryPoint = { x: position.longitude, y: position.latitude };
        // const queryPoint = { x: 120.16980200000012,y: 30.0245680000001};
        const queryParam = {
          spatialRel: "esriSpatialRelIntersects", //相交
          geometryType: "esriGeometryPoint",
          geometry: JSON.stringify({
            x: queryPoint.x,
            y: queryPoint.y,
            spatialReference: { wkid: 4490 },
          }),
          where: "1=1",
          f: "json",
        };
        // 将当前点的坐标生成多边行圆
        const point = turf.point([position.longitude,position.latitude])
        const buffered = turf.buffer(point,1,{ units: "kilometers"})
        const points = buffered.geometry.coordinates[0]
        // console.log(points);
        const queryParams = {
          spatialRel: "esriSpatialRelContains", //包含
          geometryType: "esriGeometryPolygon",
          geometry: JSON.stringify({
            rings: [points],
            spatialReference: { wkid: 4490 },
          }),
          where: "1=1",
          f: "json",
        };
      }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    },
    },
};
</script>

<style scoped lang="scss">
</style>
